﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DoAnOOP.DataAccessLayer;

namespace DoAnOOP.BussinessLayer
{
    class clsQLMH
    {
        #region Biến cục bộ
        clsConnect _myConnect = new clsConnect();

        public string MaMH { get; set; }
        public string TenMH { get; set; }
        public string TCLT { get; set; }
        public string TCTH { get; set; }
        public string MaKhoa { get; set; }
        public string NgayThi { get; set; }
        #endregion

        #region Hàm
        public DataTable LayThongTinMonHoc(string khoa)
        {
            string sql = "SELECT MAMONHOC, TENMONHOC, TCLT, TCTH, MAKHOA, NGAYTHI FROM MONHOC";
            sql += khoa;
            return _myConnect.GetDataTable(sql);
        }

        public void ThemThongTinMonHoc()
        {
            string sql = "INSERT INTO MONHOC VALUES ('" + MaMH + "','" + TenMH + "','" +
                TCLT + "','" + TCTH + "','" + MaKhoa + "','" +
                NgayThi + "')";
            _myConnect.ExecuteNonquery(sql);

        }
        public void UpdateThongTinMonHoc()
        {
            string sql = "UPDATE MONHOC SET TENMONHOC = '" + TenMH + "', TCLT = '" + TCLT + "', TCTH = '" +
                TCTH + "', MaKhoa = '" + MaKhoa + "', NgayThi = '" +
                NgayThi + "' WHERE MAMONHOC = '" + MaMH + "'";
            _myConnect.ExecuteNonquery(sql);
        }
        public void DeleteThongTinMonHoc()
        {
            string sql = "DELETE FROM MONHOC WHERE MAMONHOC = '" + MaMH + "'";
            _myConnect.ExecuteNonquery(sql);
        }
        #endregion
    }
}
